<template>
    <rx-layout>
        <div slot="center" style>
            <rx-fit>
                <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
                    <rx-list-title :title="i18n('list.bpmAuthManger','流程实例授权')"></rx-list-title>
                    <span class="search-btn-box">
                        <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>{{$ti18('rxList.leachBtn','过滤')}}</span>
                   </span>
                </div>
                <div slot="searchbar" btnalign="right"  v-if="fitSearch" @search="search" @cancel="cancel" @close="close">
                    <a-form layout="vertical">
                        <a-form-item :label="i18n('form.username','用户名')">
                            <a-input :placeholder="i18n('form.username','用户名','input')" v-model="queryParam.Q_fullname_S_LK"/>
                        </a-form-item>
                    </a-form>
                </div>
                <rx-grid
                    ref="table"
                    :multiSelect="true"
                    :columns="columns"
                    :defaultPageSize="10"
                    url="/api-user/user/org/osUser/queryUserAccess"
                    :queryParam="queryParam"
                    data-field="result.data"
                    :pageSizeOptions="['10','30','40']"
                    id-field="party2"
                    @selectChange="onSelectChange"
                >
                    <span slot="action" slot-scope="{text, record }" class="actionIcons">
                          <span @click.stop="handleAuth(record)">{{i18n('list.empower','授权')}}</span>
                      </span>
                </rx-grid>
            </rx-fit>
        </div>
    </rx-layout>
</template>

<script>
    import {BaseList,RxFit,RxGrid } from '@lowcode/jpaas-common-lib';
    export default {
        name: 'BpmUserAccess',
        mixins: [BaseList],
        components: {
            RxFit,
            RxGrid
        },
        data() {
            return {
                columns: [
                    {
                        title: this.$ti18('rxList.index','序号'),
                        type: 'indexColumn',
                        width: 60,
                        dataIndex: 'serial',
                        scopedSlots: {customRender: 'serial'}
                    },
                    {title: this.i18n('form.username','用户名'), dataIndex: 'fullname', width: 100},
                    {title: this.i18n('form.accountNum','账号'), dataIndex: 'userNo', width: 100},
                    {title: this.i18n('form.email','邮箱'), dataIndex: 'email', width: 100},
                    {title: this.i18n('form.phone','联系电话'), dataIndex: 'mobile', width: 100},
                    {title: this.i18n('form.deptName','部门'), dataIndex: 'deptName', width: 100},
                    {title: this.$ti18('rxList.action','操作'), dataIndex: 'action', width:100, scopedSlots: { customRender: 'action' }}
                ],
                fitSearch: false
            }
        },
        methods:{
            i18n(name, text, key) {
                return this.$ti18(name, text, "bpmUserAccess", key);
            },
            handleAuth(record){
                this.$router.push({
                    name:"bpmAuthByUser",
                    params:{userId:record.party2},
                    query:{appId:record.appId}
                });
            }
        }
    }
</script>
<style scoped>

</style>

